package com.mnt.washio.objects;

public class TimeObject {
	private String time;
	private boolean isMorning;
	private int twoDotIndex, hour, min;
	
	public String getTime() {
		twoDotIndex = time.indexOf(":");
		hour = Integer.parseInt(time.substring(0, twoDotIndex));
		hour = (hour>12) ? hour%12 : hour;
		
		min = Integer.parseInt(time.substring(twoDotIndex+1));
		return ((hour<10) ? ("0"+hour) : hour) + ":" + ((min<10) ? ("0"+min) : min);
	}

	public void setTime(String time) {
		this.time = time;
	}

	public boolean isMorning() {
		return isMorning;
	}

	public void setMorning(boolean isMorning) {
		this.isMorning = isMorning;
	}

	@Override
	public String toString() {
		return time;
	}
}
